package com.sinosoft.app.packmarket.biz.imp;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sinosoft.app.packmarket.biz.PackEquityBiz;
import com.sinosoft.app.packmarket.dao.PackEquityDao;
import com.sinosoft.app.packmarket.entity.PackEquity;
import com.sinosoft.system.util.page.Pagenation;

@Service
@Transactional
public class PackEquityBizImp implements PackEquityBiz{

	private static Logger log = Logger.getLogger(PackEquityBizImp.class);
	
	@Autowired
	private PackEquityDao packEquityDao;
	
	@Override
	public int insertPackEquity(PackEquity packEquity) {
		log.info("新增PackEquity数据"+packEquity.toString());
		return packEquityDao.insertPackEquity(packEquity);
	}

	@Override
	public int updatePackEquity(PackEquity packEquity) {
		log.info("更新PackEquity数据"+packEquity.toString());
		return packEquityDao.updatePackEquity(packEquity);
	}

	@Override
	public int deletePackEquity(int id) {
		log.info("删除PackEquity数据 id="+id);
		return packEquityDao.deletePackEquity(id);
	}

	@Override
	public PackEquity selectPackEquity(int id) {
		log.info("根据ID查询PackEquity数据 id="+id);
		return packEquityDao.selectPackEquity(id);
	}

	@Override
	public PackEquity selectPackEquity(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询PackEquity数据 ");
		return packEquityDao.selectPackEquity(queryKeys, queryValues);
	}

	@Override
	public int selectCountPackEquity() {
		log.info("查询PackEquity数据 总数量");
		return packEquityDao.selectCountPackEquity();
	}

	@Override
	public int selectCountPackEquity(List<String> queryKeys,List<Object> queryValues) {
		log.info("查询PackEquity数据 总数量"+queryKeys.toString());
		return packEquityDao.selectCountPackEquity(queryKeys, queryValues);
	}

	@Override
	public List<PackEquity> selectLimitPackEquity(int start, int size) {
		log.info("查询PackEquity数据 limit数量:start="+start+",size="+size);
		return packEquityDao.selectLimitPackEquity(start, size);
	}

	@Override
	public List<PackEquity> selectLimitPackEquity(List<String> queryKeys,List<Object> queryValues,int start, int size) {
		log.info("条件查询PackEquity数据数量");
		return packEquityDao.selectLimitPackEquity(queryKeys, queryValues, start,  size);
	}

	@Override
	public List<PackEquity> selectAllPackEquity() {
		log.info("查询所有PackEquity数据");
		return packEquityDao.selectAllPackEquity();
	}

	@Override
	public List<PackEquity> selectAllPackEquity(List<String> queryKeys,List<Object> queryValues) {
		log.info("条件查询所有PackEquity数据");
		return packEquityDao.selectAllPackEquity(queryKeys, queryValues);
	}

	@Override
	public Pagenation selectPagePackEquity(Pagenation page) {
		log.info("分页查询所有PackEquity数据");
		int start =	page.getStartRow();
		int size = page.getPageSize();
		List<PackEquity> rows = packEquityDao.selectLimitPackEquity(page.getQueryKeys(), page.getQueryValues(),start,size);
		int total = packEquityDao.selectCountPackEquity(page.getQueryKeys(), page.getQueryValues());
		page.setTotal(total);
		page.setRows(rows);
		return page;
	}

	public PackEquityDao getPackEquityDao() {
		return packEquityDao;
	}

	public void setPackEquityDao(PackEquityDao packEquityDao) {
		this.packEquityDao = packEquityDao;
	}

}
